"""
@ProjectName : Game
@File        : gun.py
@Author      : WorldWind(1772830365@qq.com)
@Address     : ChangSha - BoWeiFeng
@Date        : 2025/7/17 下午4:08
"""


class Gun:
    def __init__(self):
        # 枪开始是没有弹夹的
        self.clip = None
        print(f'This is __init__ method. {self.get_class_name()} class startup')
    # 弹夹安装
    def loadClip(self,clip):
        if self.clip == None:
            self.clip = clip
    # 开火
    def shoot(self,people):
        bullet = self.clip.shootBullet()
        if bullet == None:
            print('弹夹空了')
        else:
            bullet.hurt(people)
    @classmethod
    def get_class_name(cls):
        return cls.__name__

    def __del__(self):
        print(f'This is __del__ method. The {self.get_class_name()} class has been recycled')
